<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.20"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>The small3d library: small3d::Sound Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="customdoxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="logo_s.png"/></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">The small3d library
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.20 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="namespacesmall3d.html">small3d</a></li><li class="navelem"><a class="el" href="classsmall3d_1_1_sound.html">Sound</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#nested-classes">Classes</a> &#124;
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="classsmall3d_1_1_sound-members.html">List of all members</a>  </div>
  <div class="headertitle">
<div class="title">small3d::Sound Class Reference</div>  </div>
</div><!--header-->
<div class="contents">

<p>Class that loads and plays a sound from an ogg file, or a native sound file. In the latter case, the file loaded has to have been produced by converting an .ogg file to a <a class="el" href="namespacesmall3d.html">small3d</a> native binary file using the format converter program, s3dfc, produced by this project's build scripts, for example by running s3dfc engine.ogg engine.bin (this would convert an engine sound .ogg file to a native binary sound file) ATTENTION: Unfortunately the native binary files have issues across architectures. So for example binaries created on Windows do not work on Linux. They need to be created and tested separately for each.  
 <a href="classsmall3d_1_1_sound.html#details">More...</a></p>

<p><code>#include &lt;<a class="el" href="_sound_8hpp_source.html">Sound.hpp</a>&gt;</code></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:a3bf41af25f517dc9489d795402b18219"><td class="memItemLeft" align="right" valign="top"><a id="a3bf41af25f517dc9489d795402b18219"></a>
&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classsmall3d_1_1_sound.html#a3bf41af25f517dc9489d795402b18219">Sound</a> ()</td></tr>
<tr class="memdesc:a3bf41af25f517dc9489d795402b18219"><td class="mdescLeft">&#160;</td><td class="mdescRight">Default constructor. <br /></td></tr>
<tr class="separator:a3bf41af25f517dc9489d795402b18219"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a5c0dcc69eba4f4f1993d3d8aa50b28f7"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classsmall3d_1_1_sound.html#a5c0dcc69eba4f4f1993d3d8aa50b28f7">Sound</a> (const std::string soundFilePath)</td></tr>
<tr class="memdesc:a5c0dcc69eba4f4f1993d3d8aa50b28f7"><td class="mdescLeft">&#160;</td><td class="mdescRight">Ogg file loading constructor.  <a href="classsmall3d_1_1_sound.html#a5c0dcc69eba4f4f1993d3d8aa50b28f7">More...</a><br /></td></tr>
<tr class="separator:a5c0dcc69eba4f4f1993d3d8aa50b28f7"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ad099eea274cd698016aa32e40abc1b00"><td class="memItemLeft" align="right" valign="top"><a id="ad099eea274cd698016aa32e40abc1b00"></a>
&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classsmall3d_1_1_sound.html#ad099eea274cd698016aa32e40abc1b00">~Sound</a> ()</td></tr>
<tr class="memdesc:ad099eea274cd698016aa32e40abc1b00"><td class="mdescLeft">&#160;</td><td class="mdescRight">Destructor. <br /></td></tr>
<tr class="separator:ad099eea274cd698016aa32e40abc1b00"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a24b61d06b9c695f5686846fb59c78676"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classsmall3d_1_1_sound.html#a24b61d06b9c695f5686846fb59c78676">play</a> (const bool repeat=false)</td></tr>
<tr class="memdesc:a24b61d06b9c695f5686846fb59c78676"><td class="mdescLeft">&#160;</td><td class="mdescRight">Play the sound.  <a href="classsmall3d_1_1_sound.html#a24b61d06b9c695f5686846fb59c78676">More...</a><br /></td></tr>
<tr class="separator:a24b61d06b9c695f5686846fb59c78676"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a3b239ef468eae9e89c48351127b329f3"><td class="memItemLeft" align="right" valign="top"><a id="a3b239ef468eae9e89c48351127b329f3"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classsmall3d_1_1_sound.html#a3b239ef468eae9e89c48351127b329f3">stop</a> ()</td></tr>
<tr class="memdesc:a3b239ef468eae9e89c48351127b329f3"><td class="mdescLeft">&#160;</td><td class="mdescRight">Stop playing the sound. <br /></td></tr>
<tr class="separator:a3b239ef468eae9e89c48351127b329f3"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a97e6c45179e580caa5876340ea97eb4e"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classsmall3d_1_1_sound.html#a97e6c45179e580caa5876340ea97eb4e">divideVolume</a> (uint32_t divisor)</td></tr>
<tr class="memdesc:a97e6c45179e580caa5876340ea97eb4e"><td class="mdescLeft">&#160;</td><td class="mdescRight">Divide the volume (in order to lower it).  <a href="classsmall3d_1_1_sound.html#a97e6c45179e580caa5876340ea97eb4e">More...</a><br /></td></tr>
<tr class="separator:a97e6c45179e580caa5876340ea97eb4e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:abe9fffa807136a82dba901f6c1b9aeb7"><td class="memItemLeft" align="right" valign="top"><a id="abe9fffa807136a82dba901f6c1b9aeb7"></a>
&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classsmall3d_1_1_sound.html#abe9fffa807136a82dba901f6c1b9aeb7">Sound</a> (const <a class="el" href="classsmall3d_1_1_sound.html">Sound</a> &amp;other) noexcept</td></tr>
<tr class="memdesc:abe9fffa807136a82dba901f6c1b9aeb7"><td class="mdescLeft">&#160;</td><td class="mdescRight">Copy constructor. <br /></td></tr>
<tr class="separator:abe9fffa807136a82dba901f6c1b9aeb7"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aa6e96196c84086a30c9d02aa1a4aa358"><td class="memItemLeft" align="right" valign="top"><a id="aa6e96196c84086a30c9d02aa1a4aa358"></a>
&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classsmall3d_1_1_sound.html#aa6e96196c84086a30c9d02aa1a4aa358">Sound</a> (const <a class="el" href="classsmall3d_1_1_sound.html">Sound</a> &amp;&amp;other) noexcept</td></tr>
<tr class="memdesc:aa6e96196c84086a30c9d02aa1a4aa358"><td class="mdescLeft">&#160;</td><td class="mdescRight">Move constructor. <br /></td></tr>
<tr class="separator:aa6e96196c84086a30c9d02aa1a4aa358"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a018a0b62cd18522e106dee4882e09538"><td class="memItemLeft" align="right" valign="top"><a id="a018a0b62cd18522e106dee4882e09538"></a>
<a class="el" href="classsmall3d_1_1_sound.html">Sound</a> &amp;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classsmall3d_1_1_sound.html#a018a0b62cd18522e106dee4882e09538">operator=</a> (const <a class="el" href="classsmall3d_1_1_sound.html">Sound</a> &amp;other) noexcept</td></tr>
<tr class="memdesc:a018a0b62cd18522e106dee4882e09538"><td class="mdescLeft">&#160;</td><td class="mdescRight">Copy assignment. <br /></td></tr>
<tr class="separator:a018a0b62cd18522e106dee4882e09538"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a0086ccfe2e98cf4ea36a65341e7fef54"><td class="memItemLeft" align="right" valign="top"><a id="a0086ccfe2e98cf4ea36a65341e7fef54"></a>
<a class="el" href="classsmall3d_1_1_sound.html">Sound</a> &amp;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classsmall3d_1_1_sound.html#a0086ccfe2e98cf4ea36a65341e7fef54">operator=</a> (const <a class="el" href="classsmall3d_1_1_sound.html">Sound</a> &amp;&amp;other) noexcept</td></tr>
<tr class="memdesc:a0086ccfe2e98cf4ea36a65341e7fef54"><td class="mdescLeft">&#160;</td><td class="mdescRight">Move assignment. <br /></td></tr>
<tr class="separator:a0086ccfe2e98cf4ea36a65341e7fef54"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a9a6af59d139e57e095925d919efc476b"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classsmall3d_1_1_sound.html#a9a6af59d139e57e095925d919efc476b">saveBinary</a> (const std::string binaryFilePath)</td></tr>
<tr class="memdesc:a9a6af59d139e57e095925d919efc476b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Save sound data in binary format.  <a href="classsmall3d_1_1_sound.html#a9a6af59d139e57e095925d919efc476b">More...</a><br /></td></tr>
<tr class="separator:a9a6af59d139e57e095925d919efc476b"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>Class that loads and plays a sound from an ogg file, or a native sound file. In the latter case, the file loaded has to have been produced by converting an .ogg file to a <a class="el" href="namespacesmall3d.html">small3d</a> native binary file using the format converter program, s3dfc, produced by this project's build scripts, for example by running s3dfc engine.ogg engine.bin (this would convert an engine sound .ogg file to a native binary sound file) ATTENTION: Unfortunately the native binary files have issues across architectures. So for example binaries created on Windows do not work on Linux. They need to be created and tested separately for each. </p>
</div><h2 class="groupheader">Constructor &amp; Destructor Documentation</h2>
<a id="a5c0dcc69eba4f4f1993d3d8aa50b28f7"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a5c0dcc69eba4f4f1993d3d8aa50b28f7">&#9670;&nbsp;</a></span>Sound()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">small3d::Sound::Sound </td>
          <td>(</td>
          <td class="paramtype">const std::string&#160;</td>
          <td class="paramname"><em>soundFilePath</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">explicit</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Ogg file loading constructor. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">soundFilePath</td><td>The path to the ogg file from which to load the sound. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<h2 class="groupheader">Member Function Documentation</h2>
<a id="a97e6c45179e580caa5876340ea97eb4e"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a97e6c45179e580caa5876340ea97eb4e">&#9670;&nbsp;</a></span>divideVolume()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void small3d::Sound::divideVolume </td>
          <td>(</td>
          <td class="paramtype">uint32_t&#160;</td>
          <td class="paramname"><em>divisor</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Divide the volume (in order to lower it). </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">divisor</td><td>Number to divide the volume by. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="a24b61d06b9c695f5686846fb59c78676"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a24b61d06b9c695f5686846fb59c78676">&#9670;&nbsp;</a></span>play()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void small3d::Sound::play </td>
          <td>(</td>
          <td class="paramtype">const bool&#160;</td>
          <td class="paramname"><em>repeat</em> = <code>false</code></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Play the sound. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">repeat</td><td>Repeat the sound after it ends? </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="a9a6af59d139e57e095925d919efc476b"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a9a6af59d139e57e095925d919efc476b">&#9670;&nbsp;</a></span>saveBinary()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void small3d::Sound::saveBinary </td>
          <td>(</td>
          <td class="paramtype">const std::string&#160;</td>
          <td class="paramname"><em>binaryFilePath</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Save sound data in binary format. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">binaryFilePath</td><td>Path of file to save binary data to. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<hr/>The documentation for this class was generated from the following files:<ul>
<li><a class="el" href="_sound_8hpp_source.html">Sound.hpp</a></li>
<li>Sound.cpp</li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by&#160;<a href="http://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.8.20
</small></address>
</body>
</html>
